import { request } from 'umi';

/**获取报表数据 */
export async function getReptData(reptName: string, params: Record<string, string>) {
  const data = new FormData();
  data.append('reptName', reptName);
  data.append('params', JSON.stringify(params));
  return request<API.Template>('/api/restricted/excelRept/getReptData', {
    method: 'POST',
    body: data,
  });
}
/**导出报表数据 */
export async function exportRept(reptName: string, params: Record<string, string>) {
  const data = new FormData();
  data.append('reptName', reptName);
  data.append('params', JSON.stringify(params));
  return request('/api/restricted/excelRept/exportRept', {
    method: 'POST',
    body: data,
    getResponse: true,
    responseType: 'blob',
  });
}
